package com.hema.auction.http.biz;

import android.content.Context;

import com.hema.auction.bean.AddressInfo;
import com.hema.auction.http.HttpEngine;
import com.hema.auction.http.HttpTag;
import com.hema.auction.http.UrlManager;
import com.hema.auction.listener.RequestCallBack;
import com.hema.auction.utils.Utils;
import com.hema.auction.utils.manager.SPManager;

import java.util.HashMap;

import okhttp3.Call;

/**
 * author by john
 */
public class HttpManager {
    private volatile static HttpManager mInstance = null;
    private Context mContext;
    private SPManager spManager;

    private HttpManager(Context mContext) {
        this.mContext = mContext;
        this.spManager = SPManager.getInstance(mContext);
    }

    public synchronized static HttpManager getInstance(Context mContext) {
        if (null == mInstance) {
            synchronized (HttpManager.class) {
                if (null == mInstance)
                    mInstance = new HttpManager(mContext);
            }
        }
        return mInstance;
    }

    /**
     * 获取验证码
     *
     * @param phone
     * @param callBack
     * @return
     */
    public Call getCode(String phone, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("phone", phone);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_SEND_CODE, UrlManager.SEND_CODE, map, callBack);
    }

    /**
     * 验证验证码
     *
     * @param phone
     * @param code
     * @param callBack
     * @return
     */
    public Call checkCode(String phone, String code, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("phone", phone);
        map.put("code", code);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_CHECK_CODE, UrlManager.CHECK_CODE, map, callBack);
    }

    /**
     * 注册
     *
     * @param phone
     * @param pwd
     * @param callBack
     * @return
     */
    public Call register(String phone, String pwd, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("phone", phone);
        map.put("pwd", pwd);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_REGISTER, UrlManager.REGISTER, map, callBack);
    }

    /**
     * 登录
     *
     * @param phone
     * @param pwd
     * @param callBack
     * @return
     */
    public Call login(String phone, String pwd, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("phone", phone);
        map.put("pwd", pwd);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_LOGIN, UrlManager.LOGIN, map, callBack);
    }


    /**
     * 检查版本更新
     *
     * @param callBack http请求回调
     * @return
     */
    public Call checkVersion(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("uid", String.valueOf(spManager.getId()));
        map.put("act", "check");
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_CHECK_VERSION, UrlManager.CHECK_VERSION, map, callBack);
    }

    /**
     * 获取首页广告
     *
     * @param adId
     * @param callBack http请求回调
     * @return
     */
    public Call getBanner(String adId, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("ad_id", adId);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_BANNER, UrlManager.GET_BANNER, map, callBack);
    }

    /**
     * 获取悬浮广告
     *
     * @param adId
     * @param callBack http请求回调
     * @return
     */
    public Call getSuspensionAd(String adId, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("ad_id", adId);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_SUSPENSION_AD, UrlManager.GET_BANNER, map, callBack);
    }

    /**
     * 获取系统配置项
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getSysUnits(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_SYS_UNITS, UrlManager.GET_SYS_UNITS, map, callBack);
    }

    /**
     * 获取商品分类
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getAllTypes(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_ALL_TYPES, UrlManager.GET_ALL_TYPES, map, callBack);
    }

    /**
     * 根据分类获取商品
     *
     * @param id
     * @param callBack http请求回调
     * @return
     */
    public Call getGoodsByCategory(String id, int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("category_id", id);
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_GOODS_BY_CATEGORY, UrlManager.GET_GOODS_BY_CATEGORY, map, callBack);
    }

    /**
     * 获取最新成交展示
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getNewestOrders(int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_NEWST_ORDERS, UrlManager.GET_NEWST_ORDERS, map, callBack);
    }

    /**
     * 获取主页热拍商品
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getHotGoods(int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_HOT_GOODS, UrlManager.GET_HOT_GOODS, map, callBack);
    }

    /**
     * 获取我在拍的商品
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getSelfSales(int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_SELF_SALES, UrlManager.GET_SELF_SALES, map, callBack);
    }

    /**
     * 收藏商品
     *
     * @param callBack http请求回调
     * @return
     */
    public Call collectGood(String goodid, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", goodid);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_COLLECT_GOOD, UrlManager.COLLECT_GOOD, map, callBack);
    }

    /**
     * 取消收藏
     *
     * @param callBack http请求回调
     * @return
     */
    public Call delCollection(String goodid, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", goodid);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_DEL_COLLECT, UrlManager.DEL_COLLECT, map, callBack);
    }

    /**
     * 收藏列表
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getCollections(int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_COLLECTIONS, UrlManager.GET_COLLECTIONS, map, callBack);
    }

    /**
     * 用户钱包
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getUserBalance(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_USER_BALANCE, UrlManager.GET_USER_BALANCE, map, callBack);
    }

    /**
     * 文件上传
     *
     * @param callBack http请求回调
     * @return
     */
    public Call fileUpload(String data, boolean isAvatar, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("file_data", data);
        map.put("type", isAvatar ? "1" : "2");
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_FILE_UPLOAD, UrlManager.FILE_UPLOAD, map, callBack);
    }

    /**
     * 修改个人信息
     *
     * @param key
     * @param value
     * @param callBack
     * @return
     */
    public Call updateUserInfo(String key, String value, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put(key, value);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_UPDATE_USER_INFO, UrlManager.UPDATE_USER_INFO, map, callBack);
    }

    /**
     * 获取个人信息
     *
     * @param callBack
     * @return
     */
    public Call getUserInfo(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_USER_INFO, UrlManager.GET_USER_INFO, map, callBack);
    }

    /**
     * 获取竞拍记录
     *
     * @param callBack
     * @return
     */
    public Call getAuctionLog(String goodId, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", goodId);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_AUCTION_LOG, UrlManager.GET_AUCTION_LOG, map, callBack);
    }

    /**
     * 竞拍
     *
     * @param callBack
     * @return
     */
    public Call doAuction(String goodId, String upRange, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", goodId);
        map.put("up_range", upRange);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_DO_AUCTION, UrlManager.DO_AUCTION, map, callBack);
    }

    /**
     * 不中包赔付款
     *
     * @param price    金额
     * @param goodId   订单号
     * @param configId 详情返回的back_config内容里面的id
     * @param callBack http请求回调
     * @return
     */
    public Call compensationPay(String price, String goodId, String configId, String payType,RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("price", price);
        map.put("type", "3");//type=1充值；type=2我的竞拍付款；type=3不中包赔付款；type=4差价购买付款
        map.put("good_id", goodId);
        map.put("config_id", configId);
        map.put("pay_type", payType);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_DO_ORDER, UrlManager.DO_ORDER, map, callBack);
    }

    /**
     * 充值
     *
     * @param price    金额
     * @param callBack http请求回调
     * @return
     */
    public Call recharge(String price, String payType, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("price", price);
        map.put("type", "1");
        map.put("pay_type", payType);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_DO_ORDER, UrlManager.DO_ORDER, map, callBack);
    }

    /**
     * 充值拍币比例
     *
     * @param price    金额
     * @param callBack http请求回调
     * @return
     */
    public Call index(String price,RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("price", price);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_INDEX, UrlManager.INDEX, map, callBack);
    }

    /**
     * 我的竞拍付款
     *
     * @param price    金额
     * @param orderId  订单号
     * @param callBack http请求回调
     * @return
     */
    public Call myAuctionPay(float price, String orderId, String payType,String remark,RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("price", String.valueOf(price));
        map.put("type", "2");
        map.put("order_id", orderId);
        map.put("pay_type", payType);
        map.put("remark", remark);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_DO_ORDER, UrlManager.DO_ORDER, map, callBack);
    }


    /**
     * 差价购买付款
     *
     * @param price    金额
     * @param orderId  订单号
     * @param goodId   商品id
     * @param isUseGW  是否使用购物币  is_use_gw=1使用    is_use_gw=0不使用
     * @param callBack http请求回调
     * @return
     */
    public Call cjPay(float price, String orderId, String goodId, int isUseGW, String payType,String remark,RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("price", String.valueOf(price));
        map.put("type", "4");
        map.put("order_id", orderId);
        if (!Utils.isEmpty(goodId))
            map.put("good_id", goodId);
        map.put("is_use_gw", String.valueOf(isUseGW));
        map.put("pay_type", payType);
        map.put("remark", remark);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_DO_ORDER, UrlManager.DO_ORDER, map, callBack);
    }

    /**
     * 批量获取商品价格\当前竞拍人\状态（列表里用）
     *
     * @param callBack
     * @return
     */
    public Call getGoodOrder(String good_ids, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_ids", good_ids);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_GOOD_ORDER, UrlManager.GEET_GOOD_ORDER, map, callBack);
    }

    /**
     * 获取商品详情
     *
     * @param callBack
     * @return
     */
    public Call goodDetailInfo(String good_id, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", good_id);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GOOD_DETAIL_INFO, UrlManager.GOOD_DETAIL_INFO, map, callBack);
    }


    /**
     * 获取订单列表 全部、我拍中。。
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getOrderList(int pageIndex, int pageSize, int status, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        map.put("status", String.valueOf(status));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_ORDER_LIST, UrlManager.GET_ORDER_LIST, map, callBack);
    }

    /**
     * 获取差价购买订单列表...
     *
     * @param callBack http请求回调
     * @return 100:全部
     * 0:待付款
     * 1:待发货
     * 2:待签收
     * 3:待晒单
     */
    public Call getCjOrders(int pageIndex, int pageSize, int status, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        map.put("status", String.valueOf(status));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_CJ_ORDERS, UrlManager.GET_CJ_ORDERS, map, callBack);
    }

    /**
     * 发布晒单
     *
     * @param callBack http请求回调
     * @return
     */
    public Call createOneShow(String orderId, String imgs, String contents, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("order_id", orderId);
        map.put("img", imgs);
        map.put("contents", contents);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_CREATE_ONE_SHOW, UrlManager.CREATE_ONE_SHOW, map, callBack);
    }

    /**
     * 获取晒单列表
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getShows(int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_SHOWS, UrlManager.GET_SHOWS, map, callBack);
    }

    /**
     * 获取我的晒单列表
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getMyShows(int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_MY_SHOWS, UrlManager.GET_MY_SHOWS, map, callBack);
    }

    /**
     * 根据商品获取晒单列表
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getShowsByGood(String goodsId, int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", goodsId);
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_SHOWS_BY_GOOD, UrlManager.GET_SHOWS_BY_GOOD, map, callBack);
    }

    /**
     * 商品详情往期成交
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getOldrders(String goodsId, int pageIndex, int pageSize, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", goodsId);
        map.put("page", String.valueOf(pageIndex));
        map.put("size", String.valueOf(pageSize));
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_OLD_ORDERS, UrlManager.GET_OLD_ORDERS, map, callBack);
    }

    /**
     * 主页滚动广告
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getOrderBroadcast(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_ORDER_BROADCAST, UrlManager.GET_ORDER_BROADCAST, map, callBack);
    }

    /**
     * 获取消息
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getUserMessage(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_USER_MESSAGE, UrlManager.GET_USER_MESSAGE, map, callBack);
    }

    /**
     * 获取公告
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getNotice(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_NOTICE, UrlManager.GET_NOTICE, map, callBack);
    }

    /**
     * 用户信息更新为已读
     *
     * @param callBack http请求回调
     * @return
     */
    public Call readMessage(String messageId, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("message_id", messageId);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_READ_MESSAGE, UrlManager.READ_MESSAGE, map, callBack);
    }

    /**
     * 获取未读消息数量
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getNewCount(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_NEW_COUNT, UrlManager.GET_NEW_COUNT, map, callBack);
    }

    /**
     * 更新用户收货地址信息
     *
     * @param callBack http请求回调
     * @return
     */
    public Call editAddress(AddressInfo info, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("address_id", info.getId());
        map.put("name", info.getName());
        map.put("phone", info.getPhone());
        map.put("area", info.getArea());
        map.put("address", info.getAddress());
        map.put("remark", info.getRemark());
        map.put("qq_number", info.getQqNumber());
        map.put("zfb_number", info.getZfbNumber());
        map.put("zfb_name", info.getZfbName());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_EDIT_ADDRESS, UrlManager.EDIT_ADDRESS, map, callBack);
    }

    /**
     * 更新用户收货地址信息
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getAddress(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_ADDRESS, UrlManager.GET_ADDRESS, map, callBack);
    }

    /**
     * 获取订单详情
     *
     * @param callBack http请求回调
     * @return
     */
    public Call orderDetail(String orderId, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("order_id", orderId);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_ORDER_DETAIL, UrlManager.ORDER_DETAIL, map, callBack);
    }

    /**
     * 第三方登录
     *
     * @param callBack http请求回调
     * @return
     */
    public Call thirdLogin(String openId, String channel, String nickName, String facePic, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("open_id", openId);
        map.put("channel", channel);
        map.put("nick_name", nickName);
        map.put("face_pic", facePic);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_THIRD_LOGIN, UrlManager.THIRD_LOGIN, map, callBack);
    }

    /**
     * 绑定手机号
     *
     * @param callBack http请求回调
     * @return
     */
    public Call bdPhone(String phone, String code, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("phone", phone);
        map.put("code", code);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_BD_PHONE, UrlManager.BD_PHONE, map, callBack);
    }

    /**
     * 差价购买商品
     *
     * @param callBack http请求回调
     * @return
     */
    public Call cxBuy(String goodId, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", goodId);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_CX_BUY, UrlManager.CX_BUY, map, callBack);
    }

//    /**
//     * 付款
//     *
//     * @param callBack http请求回调
//     * @return
//     */
//    public Call doPay(String goodId, RequestCallBack callBack) {
//        HashMap<String, String> map = new HashMap<>();
//        map.put("user_id", spManager.getUserId());
//        map.put("good_id", goodId);
//        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_DO_PAY, UrlManager.DO_PAY, map, callBack);
//    }

    /**
     * 获取微信token
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getWXToken(String code, RequestCallBack callBack) {
        return HttpEngine.getInstance(mContext).asyncGetNormal(HttpTag.TAG_GET_WX_TOKEN, String.format(UrlManager.GET_WX_TOKEN, code), callBack);
    }

    /**
     * 获取微信个人信息
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getWXInfo(String token, String id, RequestCallBack callBack) {
        return HttpEngine.getInstance(mContext).asyncGetNormal(HttpTag.TAG_GET_WX_INFO, String.format(UrlManager.GET_WX_INFO, token, id), callBack);
    }

    /**
     * 个人中心菜单
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getUserCenter(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_USER_CENTER, UrlManager.GET_USER_CENTER, map, callBack);
    }

    /**
     * 获取不中包赔产品
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getBackSale(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_BACK_SALE, UrlManager.GET_BACK_SALE, map, callBack);
    }

    /**
     * 获取不中包赔产品
     *
     * @param callBack http请求回调
     * @return
     */
    public Call doBackAuction(String goodId, String configId, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("good_id", goodId);
        map.put("config_id", configId);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_DO_BACK_AUCTION, UrlManager.DO_BACK_AUCTION, map, callBack);
    }

    /**
     * 确认收货
     *
     * @param callBack http请求回调
     * @return
     */
    public Call sureOrder(String orderId, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("order_id", orderId);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_SURE_ORDER, UrlManager.SURE_ORDER, map, callBack);
    }

    /**
     * 获取订单支付状态
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getPayStatus(String orderSn, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("ordersn", orderSn);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_PAY_STATUS, UrlManager.GET_PAY_STATUS, map, callBack);
    }

    /**
     * 钱包记录
     *
     * @param type     类型
     * @param callBack http请求回调
     * @return
     */
    public Call getBalanceRecord(String type, RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        map.put("type", type);
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_BALANCE_RECORD, UrlManager.GET_BALANCE_RECORD, map, callBack);
    }

    /**
     * 是否显示不中包赔按钮
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getIsShowBcak(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_IS_SHOW_BACK, UrlManager.GET_IS_SHOW_BACK, map, callBack);
    }

    /**
     * 是否显示不中包赔按钮
     *
     * @param callBack http请求回调
     * @return
     */
    public Call getOneNewest(RequestCallBack callBack) {
        HashMap<String, String> map = new HashMap<>();
        map.put("user_id", spManager.getUserId());
        return HttpEngine.getInstance(mContext).asyncPost(HttpTag.TAG_GET_ONE_NEWEST, UrlManager.GET_ONE_NEWEST, map, callBack);
    }

}